{% extends "base.html" %}
{% load i18n %}

{% block page_title %}
Pinball - Workflow Instances
{% endblock %}

{% block javascript %}
<script src="{{ STATIC_URL }}js/executions.js"></script>
<script type="text/javascript" charset="utf-8">
    statusData = {"workflow": "{{ request.GET.workflow }}"};

    init = function() {
        baseInit();
        oTable = $('#executions').dataTable({
            // "sDom": "r<'row'<'span6'l><'span6'>f>t<'row'<'span6'i><'span6'>p>",
            "sPaginationType": "bootstrap",
            "oLanguage": {
                "sLengthMenu": "_MENU_ records per page"
            },
            "bProcessing": true,
            "sAjaxSource": "/ajax/executions/?" +
                "workflow={{ request.GET.workflow }}&" +
                "job={{ request.GET.job }}",
            "fnCreatedRow": getCreateRowFunc(true),  // show instance
            "aoColumns": [
                { "mData": "instance" },
                { "mData": "execution" },
                { "mData": "info" },
                { "mData": "properties" },
                { "mData": "exit_code" },
                { "mData": "start_time" },
                { "mData": "end_time" },
                { "mData": "run_time" },
                { "mData": "logs" }
            ],
            "fnServerData": getTableData,
            "aaSorting": [[ 5, "asc" ]],
            "aLengthMenu": [[10, 25, 50, 100, -1],
                            [10, 25, 50, 100, "All"]],
        });
    };
</script>
{% endblock %}

{% block workflows_active %}
class="active"
{% endblock %}

{% block breadcrumb %}
<ol class="breadcrumb">
  <li></li>
  <li>
      <a href="/instances/?workflow={{ request.GET.workflow }}">
          {{ request.GET.workflow }}
      </a>
  </li>
  <li>...</li>
  <li class="active">{{ request.GET.job }}</li>
</ol>
{% endblock breadcrumb %}

{% block content %}
<div class="row">
  <table cellpadding="0" cellspacing="0" border="0"
         class="table table-striped table-bordered" id="executions">
      <thead><tr>
          <th width="9%">Workflow instance</th>
          <th width="7%">Execution</th>
          <th width="30%">Info</th>
          <th width="10%">Properties</th>
          <th width="12%">Exit Code</th>
          <th width="8%">Start</th>
          <th width="8%">End</th>
          <th width="8%">Run Time</th>
          <th width="8%">Logs</th>
      </tr></thead>
      <tbody></tbody>
  </table>
</div>
{% endblock %}
